<?php
global $user_ID, $user_identity;
get_currentuserinfo();
if (!$user_ID) {
    ?>
    <form method="post" action="<?php bloginfo('url') ?>/wp-login.php" class="wp-user-form" id="login_form">
        <div>
             <label for="username">ឈ្មោះ</label>
             <input type="text" name="log" value="<?php if (isset($user_login)) echo esc_attr(stripslashes($user_login)); ?>"/>
            
        </div>
        <div>
            <label for="username">ពាក្យ​សម្ងាត់</label>
            <input type="password" name="pwd" />
            
        </div>
        <div class="login-action">
            <input class="button_red" type="submit" value="ចុច​ចូល" />
            <p><a href="<?php echo WP_SITEURL. '/recover-password/'?>">ភ្លេច​ពាក្យ​សម្ងាត់ឬ?</a></p>
            <p><a href="<?php echo WP_SITEURL. '/register/' ?>">មិន​ទាន់ជា​សមាជិក​ឬ?</a></p>
        </div>
        <?php do_action('login_form'); ?>


        <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
        <input type="hidden" name="user-cookie" value="1" />
    </form>
<?php } else { // is logged in   ?>
<div class="current_user">
    <h4>សួស្ដី, <?php echo $user_identity; ?></h4>
    <div class="usericon">
        <?php
        global $userdata;
        get_currentuserinfo();
        echo get_avatar($userdata->ID, 60);
        ?>

    </div>
    <div class="userinfo">
       
      
        <p>
            <a href="<?php echo wp_logout_url('index.php'); ?>">Log out</a> | 
            <?php
            if (current_user_can('manage_options')) {
                echo '<a href="' . admin_url() . '">' . __('Admin') . '</a>';
            } else {
                echo '<a href="' . WP_SITEURL . '/edit-profile/">' . __('Profile') . '</a>';
            }
            ?>

        </p>
    </div>
</div>
<?php } ?>
<!--
<h3>សមាជិក</h3>
<form id="login_form">
    <div>
        <label for="username">ឈ្មោះ</label>
        <input type="text" name="username"/>
    </div>
    <div>
        <label for="username">ពាក្យ​សម្ងាត់</label>
        <input type="password" name="password" />
    </div>
    <div class="remberme"> 
        <input type="checkbox" name="remberme"/> <span>ចង់​ចាំខ្ញុំ​</span>
    </div>
    <div class="login-action">
        <input class="button_red" type="submit" value="ចុច​ចូល" />
        <p><a href="#">ភ្លេច​ពាក្យ​សម្ងាត់ឬ?</a></p>
        <p><a href="#">មិន​ទាន​ជា​សមាជិក​ឬ?</a></p>
    </div>

</form>
-->

